package ru.slovoslovo.cropmotion.ui.filetable;

import java.io.File;
import java.util.ArrayList;

import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;

public class TableContentProvider implements IStructuredContentProvider {
    
    public Object[] getElements(Object inputElement) {
        ArrayList<File> result = new ArrayList<File>();
        File rootFile = (File) inputElement;
        if (rootFile.listFiles() != null){
            for (File file : rootFile.listFiles()){
                if (!file.isDirectory()){
                    result.add(file);
                }
            }
        }
        return result.toArray(new Object[0]);
    }
    
    public void dispose() {
    }
    
    public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
    }
}